require("should");

const { longToStr, strToLong, format } = require("../lib/date/index");

describe("Date", function () {
	it("test longToStr: 20180515111111 should be 2018/05/15 11:11:11 ", function () {
		const result = longToStr(20180515111111, "yyyy/MM/dd hh:mm:ss");

		result.should.be.equal("2018/05/15 11:11:11");
	});

	it("test strToLong: 2018/05/15 11:11:11 should be 20180515111111 ", function () {
		const result = strToLong("2018/05/15 11:11:11");
		result.should.be.equal(20180515111111);
	});

	it("test format: 2018/05/15 11:11:11 `format(yyyy-MM-dd hh:mm:ss)` should be 2018-05-15 11:11:11 ", function () {
		const result = format(new Date("2018/05/15 11:11:11"), "yyyy-MM-dd hh:mm:ss");
		result.should.be.equal("2018-05-15 11:11:11");
	});
});
